home *** CD-ROM | disk | FTP | other *** search
- /* -----------------------------------------------------------------------------
-
- COPYIGHT
-
- ©1995 Dietmar Eilert (e-mail: DIETMAR@TOMATE.TNG.OCHE.DE). All Rights
- Reserved. Code may not be reused/reproduced without written permission of
- the author.
-
- Dietmar Eilert
- Mies-v-d-Rohe-Str.31, 52074 Aachen, Germany
- E-Mail: DIETMAR@TOMATE.TNG.OCHE.DE
- Tel: +49-(0)241-81665
- +49-(0)2525-7776
- Fax: +49-(0)241-81665
-
- Example: scan handler looking for AutoDoc nodes. Scan handlers are plain
- functions (LoadSeg'ed by GED): no standard C startup code, no library calls.
- This handler is faster than GoldED's built in AutoDoc handler since it simply
- looks for formfeeds. Won't work with all AutoDocs though Commodore's AutoDocs
- are handled properly.
-
- DICE C:
-
- dcc autodoc.c -// -l0 -md -mRR -o ram:autodoc
-
- ------------------------------------------------------------------------------
- */
-
- #include <exec/types.h>
-
- #define FORMFEED 12
-
- ULONG
- ScanHandlerGuide(__D0 ULONG len, __A0 char **text, __A1 ULONG *line)
- {
- // look for node header
-
- const char *version = "$VER: ADoc 1.3 (" __COMMODORE_DATE__ ")";
-
- if (**text == FORMFEED) {
-
- // look for beginning of header string (e.g. "Dos.Library/Open")
-
- while (len && (**text <= ' ')) {
-
- ++*text;
- --len;
- }
-
- // ignore first part of header string
-
- while (len && (**text != '/')) {
-
- ++*text;
- len--;
- }
-
- // extract node name
-
- if (len) {
-
- UWORD letters;
-
- ++*text;
- --len;
-
- for (letters = 0; len && ((*text)[letters] != 32); --len)
- ++letters;
-
- return(letters);
- }
- }
-
- return(FALSE);
- }
-